package com.googlecode.wicketcharts.highcharts.gson;

import java.lang.reflect.Type;

import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

/**
 * Serializes enums into lower case strings.
 * 
 * @author Tom
 * 
 */
public class GsonLowercaseEnumSerializer implements JsonSerializer<GsonLowercaseEnum> {

	@Override
	public JsonElement serialize(GsonLowercaseEnum src, Type typeOfSrc, JsonSerializationContext context) {
		return new JsonPrimitive(src.toString().toLowerCase());
	}

}
